<!DOCTYPE html>
<html>
<head>
    <title>WebSocket Test</title>
    <script type="text/javascript">
        var socket = new WebSocket('ws://localhost:8080/ws');

        socket.onopen = function() {
            console.log('Connection open!');
        };

        socket.onmessage = function(event) {
            console.log('Received: ' + event.data);
            document.getElementById('messages').innerHTML += '<p>' + event.data + '</p>';
        };

        socket.onclose = function() {
            console.log('Connection closed');
        };
    </script>
</head>
<body>
<h1>WebSocket Test</h1>
<div id="messages"></div>
</body>
</html>